// google c++ style guide
// SSD HW4: design pattern - lazy initialization

#include "fasta_parser.h"
#include "dna_info_holder.h"
#include "dna_info.h"

using fasta_parser::FastaParser;
using design_patterns::DnaInfoHolder;
using design_patterns::DnaInfo;

using std::map;
using std::string;

int main(int argc, char** argv)
{
  // Suppose, we want to design an application that will accept some ID of DNA
  // record, then extract DNA itself from database and do some costly work on it
  // (say, predict some regions using HMM).
  // Of course it wouldn't be very smart to process entire database at the start
  // of application because it's unlikely that we want to get information about
  // every record.
  // So instead of it we can lazy initialize object containing info 
  // about specific sequence only when we will be asked about it.
  // For the purpose of a simplicity let a database will be just 
  // map<string, string> with sequence header as key and DNA as value
  // Let's create it from fasta file first:
  FastaParser parser(argv[1]);
  map<string, string> records;
  parser.GetAllFastaSequencesPairs(&records);

  // then let's take headers we need (say, they will be passed in the rest of 
  // the args) and process them
  DnaInfoHolder dna_info_holder(std::move(records));
  for (int i = 2; i < argc; ++i)
  {
    string next_header(argv[i]);
    DnaInfo& dna_info = dna_info_holder.GetDnaInfo(next_header);
    //do some work with DnaInfo
  }

  return 0;
}